# Copyright (c) 2024 Huawei Technologies Co., Ltd.
#
# openMind is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
#          http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.

import os
import json

file_path = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(file_path, "public_address_lib.json"), "r") as cfg_file:
    json_file = cfg_file.read()
    OPENMIND_HUB_ENDPOINT = json.loads(json_file)["openmind_hub_endpoint"]
    HUB_RIGHT_URL = json.loads(json_file)["hub_right_url"]
    HUB_WRONG_URL = json.loads(json_file)["hub_wrong_url"]
    # This is a pinned image from a specific revision of a document question answering space, hosted by HuggingFace,
    # so we can expect it to be available.
    PIPELINE_DOCUMENT_QA_URL = json.loads(json_file)["pipeline_document_qa_url"]
    PIPELINE_COCO_IMAGE_URL = json.loads(json_file)["pipeline_coco_image_url"]
    PIPELINE_MASK_IMAGE_URL_0 = json.loads(json_file)["pipeline_mask_image_url_0"]
    PIPELINE_MASK_IMAGE_URL_1 = json.loads(json_file)["pipeline_mask_image_url_1"]
    PIPELINE_MASK_IMAGE_URL_2 = json.loads(json_file)["pipeline_mask_image_url_2"]
    CHATGLM_URL = json.loads(json_file)["chatglm_url"]
    T5_URL = json.loads(json_file)["t5_url"]
    OPENMIND_MODEL_URL = json.loads(json_file)["openmind_model_url"]
    HUGGINGFACE_MODEL_URL = json.loads(json_file)["huggingface_model_url"]

TIMEOUT_30 = 30
